<?php

require '../model/saiduanmodel.php';

class saiduancontrol{
	private $model;//业务模型
	private $view;

	public function __construct(){
		
		$this->view="../view/main.php?url=saiduan.php";
		$this->model=new saiduanmodel();
	}


	public function load($view=null){
		if(empty($view))
		{				
			header("location:{$this->view}");
		}
		else{
			header("location:{$view}");
		}

	}
	
	/*
	 *
	*
	*/
	public function doAction($action){


		if($action=='saiduanquery'){
			
			$this->action_saiduanquery();
		}
		else if ($action=='saiduantian'){
			
			$this->action_saiduantian();
		}
		else{
			$this->load();
		}

	}

	//公告查询
	public function action_saiduanquery(){
			
		//回自己界面
		$this->load($this->view."&saiduanid=".$_POST['saiduanid']);
		
	}
	//公告添加
	public function action_saiduantian(){
		if (!empty($_POST['saiduan'])){		
	    $saiduan=new  saiduanmodel();
	    $saiduan->saiduantian($_POST['saiduan']);
		}
		
		else {
			
		}
		//回自己界面
		$this->load($this->view);
	}
	
}
?>